package fx;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;

public class TestCollection {
    public static void main(String[] args) {
        Collection<Integer> c = new ArrayList<>();
        c.add(100);
        c.add(200);
        c.add(300);
        c.add(400);
        c.add(500);
        System.out.println(c);
//        c.clear();
//        System.out.println(c);
        System.out.println(c.contains(300));
        System.out.println(c.hashCode());
        System.out.println(c.isEmpty());
        System.out.println(c.remove(100));
        System.out.println(c);
        System.out.println(c.size());
        System.out.println(c.equals(200));

        Object[]array = c.toArray();
        System.out.println(Arrays.toString(array));

        Collection<Integer> c2 = new ArrayList<>();
        c2.add(2);
        c2.add(4);
        c2.add(6);
        System.out.println(c2);
        c.addAll(c2);
        System.out.println(c);
        System.out.println(c2);
        System.out.println(c.contains(c2));
        System.out.println(c.containsAll(c2));
//        System.out.println(c.removeAll(c2));
//        System.out.println(c);
//        System.out.println(c.retainAll(c2));
//        System.out.println(c);

        Iterator<Integer> it = c.iterator();
        while (it.hasNext()){
            Integer num = it.next();
            System.out.println(num);
        }



    }
}
